;# csv.tcl

;# open the csv file
set f [open [lindex $argv 0] r]
  set filedata [read $f]
close $f

;# split into lines
set filedata [split $filedata \n]

;# field names - goes unused
set field_name_data [lindex $filedata 0]
set field_names [split $field_name_data ,]

;# output company name & symbol to read in algowala
foreach line [lrange $filedata 1 end] {
  set field_values [split $line ,] ;# extract fields
  set company [string map {{ } _} [lindex $field_values 3]] ;# replace space with _
  set symbol [lindex $field_values 7] 
  puts "$symbol $company"
}
